// 注册请求
import 'package:flutter/foundation.dart';
import 'dart:convert';
import 'T.dart';

class UserRegisterRequestEntity {
  String mobile;

  UserRegisterRequestEntity({
    required this.mobile,
  });

  factory UserRegisterRequestEntity.fromJson(Map<String, dynamic> json) =>
      UserRegisterRequestEntity(
        mobile: json["mobile"],
      );

  Map<String, dynamic> toJson() => {
        "mobile": mobile,
      };
}

// 注册返回

class UserRegisterResponseEntity {
  UserRegisterResponseEntity({
    this.code,
    this.msg,
  });

  factory UserRegisterResponseEntity.fromJson(Map<String, dynamic> jsonRes) =>
      UserRegisterResponseEntity(
        code: asT<dynamic>(jsonRes['code']),
        msg: asT<String?>(jsonRes['msg']),
      );

  dynamic code;
  String? msg;

  // @override
  // String toString() {
  //   return jsonEncode(this);
  // }

  Map<String, dynamic> toJson() => <String, dynamic>{
        'code': code.toString(),
        'msg': msg,
      };
}

// 登录请求
class UserLoginRequestEntity {
  String mobile;
  int type;
  String? code;
  String? password;

  UserLoginRequestEntity({
    required this.mobile,
    required this.type,
    this.code,
    this.password,
  });

  factory UserLoginRequestEntity.fromJson(Map<String, dynamic> json) =>
      UserLoginRequestEntity(
        mobile: json["mobile"],
        type: json['type'],
        code: json['code'],
        password: json["password"],
      );

  Map<String, dynamic> toJson() {
    if (type == 1) {
      return {
        "mobile": mobile,
        "code": code,
        "type": type,
      };
    } else {
      return {
        "mobile": mobile,
        "password": password,
        "type": type,
      };
    }
  }
}

/// UserLoginResponseEntity

// 登录返回

// @immutable
class UserLoginResponseEntity {
  final int? code;
  final Info? info;

  const UserLoginResponseEntity({this.code, this.info});

  @override
  String toString() => 'UserLoginResponseEntity(code: $code, info: $info)';

  factory UserLoginResponseEntity.fromCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg(
      Map<String, dynamic> data) {
    return UserLoginResponseEntity(
      code: data['code'] as int?,
      info: data['info'] == null
          ? null
          : Info
              .fromCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg(
                  data['info'] as Map<String, dynamic>),
    );
  }

  Map<String, dynamic>
      toCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg() {
    return {
      'code': code,
      'info': info
          ?.toCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg(),
    };
  }

  /// `dart:convert`
  ///
  /// Parses the string and returns the resulting Json object as [UserLoginResponseEntity].
  factory UserLoginResponseEntity.fromJson(String data) {
    return UserLoginResponseEntity
        .fromCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg(
            json.decode(data) as Map<String, dynamic>);
  }

  /// `dart:convert`
  ///
  /// Converts [UserLoginResponseEntity] to a JSON string.
  String toJson() => json.encode(
      toCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg());

  @override
  bool operator ==(Object other) {
    if (identical(other, this)) return true;
    if (other is! UserLoginResponseEntity) return false;
    return mapEquals(
        other
            .toCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg(),
        toCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg());
  }

  @override
  int get hashCode => code.hashCode ^ info.hashCode;
}

@immutable
class Info {
  final String? id;
  final String? name;
  final String? head;
  final String? openid;
  final String? mobile;
  final String? age;
  final String? sex;
  final String? provience;
  final String? city;
  final String? lng;
  final String? lat;
  final String? birthday;
  final String? height;
  final String? marry;
  final String? wechatNum;
  final String? qqNum;
  final String? work;
  final String? profession;
  final String? money;
  final String? school;
  final String? edu;
  final String? stuWay;
  final String? about;
  final String? interest;
  final String? emotion;
  final String? likePersion;
  final String? addTime;
  final String? avatarUrl;
  final String? token;

  const Info({
    this.id,
    this.name,
    this.head,
    this.openid,
    this.mobile,
    this.age,
    this.sex,
    this.provience,
    this.city,
    this.lng,
    this.lat,
    this.birthday,
    this.height,
    this.marry,
    this.wechatNum,
    this.qqNum,
    this.work,
    this.profession,
    this.money,
    this.school,
    this.edu,
    this.stuWay,
    this.about,
    this.interest,
    this.emotion,
    this.likePersion,
    this.addTime,
    this.avatarUrl,
    this.token,
  });

  @override
  String toString() {
    return 'Info(id: $id, name: $name, head: $head, openid: $openid, mobile: $mobile, age: $age, sex: $sex, provience: $provience, city: $city, lng: $lng, lat: $lat, birthday: $birthday, height: $height, marry: $marry, wechatNum: $wechatNum, qqNum: $qqNum, work: $work, profession: $profession, money: $money, school: $school, edu: $edu, stuWay: $stuWay, about: $about, interest: $interest, emotion: $emotion, likePersion: $likePersion, addTime: $addTime, avatarUrl: $avatarUrl, token: $token)';
  }

  factory Info.fromCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg(
      Map<String, dynamic> data) {
    return Info(
      id: data['id'] as String?,
      name: data['name'] as String?,
      head: data['head'] as String?,
      openid: data['openid'] as String?,
      mobile: data['mobile'] as String?,
      age: data['age'] as String?,
      sex: data['sex'] as String?,
      provience: data['provience'] as String?,
      city: data['city'] as String?,
      lng: data['lng'] as String?,
      lat: data['lat'] as String?,
      birthday: data['birthday'] as String?,
      height: data['height'] as String?,
      marry: data['marry'] as String?,
      wechatNum: data['wechat_num'] as String?,
      qqNum: data['qq_num'] as String?,
      work: data['work'] as String?,
      profession: data['profession'] as String?,
      money: data['money'] as String?,
      school: data['school'] as String?,
      edu: data['edu'] as String?,
      stuWay: data['stu_way'] as String?,
      about: data['about'] as String?,
      interest: data['interest'] as String?,
      emotion: data['emotion'] as String?,
      likePersion: data['like_persion'] as String?,
      addTime: data['add_time'] as String?,
      avatarUrl: data['avatarUrl'] as String?,
      token: data['token'] as String?,
    );
  }

  Map<String, dynamic>
      toCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg() {
    return {
      'id': id,
      'name': name,
      'head': head,
      'openid': openid,
      'mobile': mobile,
      'age': age,
      'sex': sex,
      'provience': provience,
      'city': city,
      'lng': lng,
      'lat': lat,
      'birthday': birthday,
      'height': height,
      'marry': marry,
      'wechat_num': wechatNum,
      'qq_num': qqNum,
      'work': work,
      'profession': profession,
      'money': money,
      'school': school,
      'edu': edu,
      'stu_way': stuWay,
      'about': about,
      'interest': interest,
      'emotion': emotion,
      'like_persion': likePersion,
      'add_time': addTime,
      'avatarUrl': avatarUrl,
      'token': token,
    };
  }

  /// `dart:convert`
  ///
  /// Parses the string and returns the resulting Json object as [Info].
  factory Info.fromJson(String data) {
    return Info
        .fromCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg(
            json.decode(data) as Map<String, dynamic>);
  }

  /// `dart:convert`
  ///
  /// Converts [Info] to a JSON string.
  String toJson() => json.encode(
      toCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg());

  @override
  bool operator ==(Object other) {
    if (identical(other, this)) return true;
    if (other is! Info) return false;
    return mapEquals(
        other
            .toCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg(),
        toCode1InfoId3NameHeadOpenidMobile18660745880Age0Sex0Provience0City0LngLatBirthdayHeight0Marry0WechatNumQqNumWork0Profession0Money0SchoolEdu0StuWay0AboutInterestEmotionLikePersionAddTimeAvatarUrlTokenB157Uf1D7NFkdjDaJIjxutlF6B1pShm3U2HlZ6I7Hty65KYra7vk360KQg());
  }

  @override
  int get hashCode =>
      id.hashCode ^
      name.hashCode ^
      head.hashCode ^
      openid.hashCode ^
      mobile.hashCode ^
      age.hashCode ^
      sex.hashCode ^
      provience.hashCode ^
      city.hashCode ^
      lng.hashCode ^
      lat.hashCode ^
      birthday.hashCode ^
      height.hashCode ^
      marry.hashCode ^
      wechatNum.hashCode ^
      qqNum.hashCode ^
      work.hashCode ^
      profession.hashCode ^
      money.hashCode ^
      school.hashCode ^
      edu.hashCode ^
      stuWay.hashCode ^
      about.hashCode ^
      interest.hashCode ^
      emotion.hashCode ^
      likePersion.hashCode ^
      addTime.hashCode ^
      avatarUrl.hashCode ^
      token.hashCode;
}
